#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int push_pop(char * push, char * pop)
{
	if (NULL == push || NULL == pop) {
         return -1;
	}
//	char *push = push;
	int length = strlen(push);
	char stack[length];
	int head = -1;	
	while (*push) {
		if (*pop == *push) {
			pop++;
			while (*pop == stack[head]) {
				head--;
				pop++;
			}
			push++;
		}
		else {
			stack[++head] = *push++;
		}
	}
	while (*pop) {
		if (*pop == stack[head--]) {
			pop++;
		}
		else {
			return 0;
		}
	}
	return 1;
}

/*
int main()
{
    char * pop = "45231";
	char * push = "12345";
	printf("%d\n", push_pop(push, pop));	
}
*/
